package com.guigu.springcloud.service;


import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Component
// 绑定服务名，在这里统一处理
@FeignClient(value = "CLOUD-HYSTRIX-PROVIDER-PAYMENT", fallback = PaymentFullBackService.class)
public interface PaymentFeignService {

//    @GetMapping(value = "/payment/{id}")
//    CommonResult findById(@PathVariable("id") Long id);
//
//    @PostMapping("/payment")
//    CommonResult create(@RequestBody Payment payment);

    @GetMapping(value = "/payment/hystrix/{id}")
    String testHystrix_Ok(@PathVariable("id") Long id);

    @GetMapping(value = "/payment/hystrix")
    String testHystrix_Timeout();

    // 服务熔断
    @GetMapping("/payment/circuitBeaker/{id}")
    String paymentCircuitBreaker(@PathVariable("id") Integer id);
}
